/*----------------------------------------------------------------
 *  Author:        Funing Teng
 *  Written:       02/10/2014
 *  Last updated:  02/10/2014
 *
 *  Person who uses the system to make order and make a payment. 
 *  The customer can be a member or a guest.
 *
 *----------------------------------------------------------------*/

package JavaSource;
import java.io.Serializable;
import java.util.*;
/**
 *
 * @author Funing Teng
 * @version 1.0
 */
public class Customer implements Serializable,IdGenerable{
    
    // Attribute
    private static int globalId=2000;
    private int customerID;
    private String name;
    private String email;
    private String deliveryAddress;
    private String phoneNumber;
    private boolean paymentMethod;  //false for cash, true for credit card
    private String password;
    private Order currentOrder;

    // Constructor
    public Customer( String name, String email, String deliveryAddress, String phoneNumber, boolean paymentMethod, String password) {
        this.customerID = generateId();
        this.name = name;
        this.email = email;
        this.deliveryAddress = deliveryAddress;
        this.phoneNumber = phoneNumber;
        this.paymentMethod = paymentMethod;
        this.password = password;
         currentOrder = new Order(this);
    }
    
    public Customer(String name, String email, String password){
    
        this.customerID=generateId();
        this.name=name;
        this.email=email;
        this.password=password;
         currentOrder = new Order(this);
                
    }
   public Customer(){
   this.customerID=generateId();
   currentOrder = new Order(this);
   }

    // Methods
    public Order getCurrentOrder() {
        return currentOrder;
    }

    public void setCurrentOrder(Order currentOrder) {
        this.currentOrder = currentOrder;
    }
    
    public static int getGlobalId() {
        return globalId;
    }

    public static void setGlobalId(int globalId) {
        Customer.globalId = globalId;
    }
    
    public int getCustomerID() {
        return customerID;
    }

    public void setCustomerID(int customerID) {
        this.customerID = customerID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDeliveryAddress() {
        return deliveryAddress;
    }

    public void setDeliveryAddress(String deliveryAddress) {
        this.deliveryAddress = deliveryAddress;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public boolean getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(boolean paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
 
    /**
     * 
     * @return true 
     */
    public boolean equals(String nm, String pw) {
        return false;
    }

    @Override
    public int generateId() {
       return ++globalId;
    }
    
    
    
    
}
